package ccrClasses.layer2;

import ccrClasses.ICcr;

public class Fulfillment implements ICcr {
	
	public final static String OPEN_TAG = "<Fulfillment>";

	public final static String CLOSE_TAG = "</Fulfillment>";
	
	private Quantity quantity;
	
	private DateTime dispenseDate;
	
	public Fulfillment(Quantity quantity, DateTime dispenseDate) {
		super();
		this.quantity = quantity;
		this.dispenseDate = dispenseDate;
	}
	
	public Fulfillment(Quantity quantity) {
		super();
		this.quantity = quantity;
	}
	
	public Fulfillment(DateTime dispenseDate) {
		super();
		this.dispenseDate = dispenseDate;
	}
	
	public Fulfillment() {
		super();
	}
	
	/**
	 * @return the quantity
	 */
	public Quantity getQuantity() {
		return quantity;
	}

	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Quantity quantity) {
		this.quantity = quantity;
	}

	/**
	 * @return the dispenseDate
	 */
	public DateTime getDispenseDate() {
		return dispenseDate;
	}

	/**
	 * @param dispenseDate the dispenseDate to set
	 */
	public void setDispenseDate(DateTime dispenseDate) {
		this.dispenseDate = dispenseDate;
	}

	@Override
	public String constructCcrString() {
		String ccrFull = OPEN_TAG;
		if(quantity != null){
			ccrFull += quantity.constructCcrString();
		}
		
		if(dispenseDate != null){
			ccrFull += dispenseDate.constructCcrString();
		}
		
		ccrFull += CLOSE_TAG;
		return ccrFull;
	}

}
